package oot.view;

import oot.activity.FlashScreenActivity;
import oot.activity.TweetActivity;
import oot.data.Config;
import oot.data.Tweet;
import oot.tab.activity.FragmentTabs;
import oot.tab.activity.R;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class HeadTab {
	private Activity mActivity;
	private Button btTweet;
	public HeadTab(Activity ct){
		mActivity = ct;
	}
	public void createHeadTabAction(String headName){
		btTweet= (Button) mActivity.findViewById(R.id.bt_tweet);
		TextView head = (TextView) mActivity.findViewById(R.id.tv_head_tab_name);
		head.setText(headName);
		btTweet.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent i = new Intent(mActivity.getApplicationContext(), TweetActivity.class);
				Tweet tempT = new Tweet();
				tempT.setParentTweetId(Tweet.NO_PARENT);
				tempT.setType(Tweet.TYPE_NEW);
				i.putExtra(Config.TEMP_TWEET, tempT);
				mActivity.startActivity(i);
			}
		});
		head.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent i = new Intent(mActivity.getApplicationContext(), FragmentTabs.class);
				i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				i.putExtra("user", FlashScreenActivity.user);
				mActivity.startActivity(i);
			}
		});
	}
}
